package Problem;


import java.util.Scanner;

//
// Created by ✎﹏ℳ๓独赏☆独醉 on 2024/1/17.
// 
public class 两两相乘求和 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int num = scan.nextInt();
        int[] arr = new int[num+1];
        int[] temp = new int[num+1];
        long sum = 0;
        for (int i = 1; i <= num; i++) {
            arr[i] = scan.nextInt();
            temp[i] = arr[i] + temp[i-1];
        }
        for (int i = 1; i <= num; i++) {
            sum += (long) arr[i] *(temp[num]-temp[i]);
        }
        System.out.println(sum);
    }
}
